package com.mate.cloud.service.impl;

import com.mate.cloud.enums.IMMessageExceptionEnum;
import com.mate.cloud.exception.BusinessException;
import com.mate.cloud.exception.UserExceptionCode;
import com.mate.cloud.service.ExceptionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class ExceptionServiceImpl implements ExceptionService {


    @Override
    public void exceptionMessage() {
        throw new BusinessException(IMMessageExceptionEnum.IM_REQUEST_ERROR.getCode());
    }

    @Override
    public void exceptionMessage(String code) {

        if (code.equals("100001")) {

//            throw new BusinessRuntimeException(IMMessageExceptionEnum.IM_REQUEST_ERROR.getCode(),IMMessageExceptionEnum.IM_REQUEST_ERROR.getErrorMessage());
            throw new BusinessException(IMMessageExceptionEnum.IM_REQUEST_ERROR);
        }
    }

    @Override
    public void exceptionCodeMessage() {
        throw new BusinessException(UserExceptionCode.EMAIL_ALREADY_REGISTER.getCode(), "li448341911@qq.com");
    }
}
